#include <stdio.h>

int main()
{
    int x,n,day,s;
    scanf("%d %d",&x,&n);

    if(n>=7)
        {
            day=(6-x)+5*(n/7);
            if(x==7) day=5*(n/7);
            s=250*day;
            printf("%d",s);
        }
    else
        {
            int sum,i,week[8]={0,250,250,250,250,250,0,0};
            for(i=x;i<=x+n-1;i++)
                sum=sum+week[i];
            printf("%d",sum);
        }
    return 0;
}